﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Collections;
namespace Duyet_WEB
{
    public partial class Trinh_duyet : Form
    {
        public Trinh_duyet()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            cbAddress.Items.Add("http://google.com");
            cbAddress.Items.Add("http://fb.com/phongnguyen001");
            cbAddress.Items.Add("http://vnepress.net");
            cbAddress.Text = cbAddress.Items[0].ToString();
            btGo_Click(sender, e);
        }

        private void btGo_Click(object sender, EventArgs e)
        {
            webbrowser.Url = new Uri(cbAddress.Text);
            pixload.Image = Duyet_WEB.Properties.Resources.loadingrs;     
        }

        private void cbAddress_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                for (int i = 0; i < cbAddress.Items.Count; i++)
                {
                    if (cbAddress.Items[i].ToString() == cbAddress.Text)
                        return;
                }
                cbAddress.Items.Add(cbAddress.Text);
                btGo_Click(sender, e);
            }
        }

        private void btStop_Click(object sender, EventArgs e)
        {
            webbrowser.Stop();
        }

        private void btRefresh_Click(object sender, EventArgs e)
        {
            webbrowser.Refresh();
        }

        private void btBack_Click(object sender, EventArgs e)
        {
            webbrowser.GoBack();
        }

        private void webbrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            pixload.Image = Duyet_WEB.Properties.Resources.loadedrs;
            this.Text = webbrowser.DocumentTitle;      
        }

        private void cbAddress_SelectedIndexChanged(object sender, EventArgs e)
        {
            btGo_Click(sender, e);
        }

        private void btGo_Click_1(object sender, EventArgs e)
        {

        }

        private void btrefresh_Click_1(object sender, EventArgs e)
        {

        }

        private void btStop_Click_1(object sender, EventArgs e)
        {

        }

        private void btNext_Click(object sender, EventArgs e)
        {
            webbrowser.GoForward();
        }

      
       
    }
}
